public class NetworkLink {
	int linkID;
	int capacity;
	int freeflowTravelTime;
	int flow;
	int travelTime;
	int linkDelay;
	int ControlDelay;
	int fromNodeID;
	int toNodeID;
	int direction; //1 north-south -1 east-west
	int greenTime;
	int cycleLength;

	public NetworkLink(int linkID, int capacity, int freeflowTravelTime, int fromNodeID, int toNodeID, int direction) {
		super();
		this.linkID=linkID;
		this.capacity=capacity;
		this.freeflowTravelTime=freeflowTravelTime;
		this.travelTime=freeflowTravelTime;
		this.fromNodeID=fromNodeID;
		this.toNodeID=toNodeID;
	}

	public NetworkLink(NetworkLink link) {
		super();
		this.linkID = link.linkID;
		this.capacity = link.capacity;
		this.freeflowTravelTime = link.freeflowTravelTime;
		this.flow = link.flow;
		this.travelTime = link.travelTime;
		this.linkDelay = link.linkDelay;
		this.ControlDelay = link.ControlDelay;
		this.fromNodeID = link.fromNodeID;
		this.toNodeID = link.toNodeID;
		this.direction = link.direction;
		this.greenTime=link.greenTime;
		this.cycleLength=link.cycleLength;
	}

	public int getLinkID() {
		return linkID;
	}

	public void setLinkID(int linkID) {
		this.linkID = linkID;
	}

	public int getCapacity() {
		return capacity;
	}

	public void setCapacity(int capacity) {
		this.capacity = capacity;
	}

	public int getFreeflowTravelTime() {
		return freeflowTravelTime;
	}

	public void setFreeflowTravelTime(int freeflowTravelTime) {
		this.freeflowTravelTime = freeflowTravelTime;
	}

	public int getFlow() {
		return flow;
	}

	public void setFlow(int flow) {
		this.flow = flow;
	}

	public int getTravelTime() {
		return travelTime;
	}

	public void setTravelTime(int travelTime) {
		this.travelTime = travelTime;
	}

	public int getLinkDelay() {
		return linkDelay;
	}

	public void setLinkDelay(int linkDelay) {
		this.linkDelay = linkDelay;
	}

	public int getDirection() {
		return direction;
	}

	public void setDirection(int direction) {
		this.direction = direction;
	}

	public int getControlDelay() {
		return ControlDelay;
	}

	public int calculateLinkDelay() {
		return (int)((double)this.freeflowTravelTime*(1+0.15*Math.pow(((double)this.calculateVCRatio()), 4)));
	}
	
	public int calculateTravelTime() {
		return this.calculateLinkDelay()+this.ControlDelay;
	}

	public void setControlDelay(int controlDelay) {
		ControlDelay = controlDelay;
	}

	public int getFromNodeID() {
		return fromNodeID;
	}

	public void setFromNodeID(int fromNodeID) {
		this.fromNodeID = fromNodeID;
	}

	public int getToNodeID() {
		return toNodeID;
	}

	public void setToNodeID(int toNodeID) {
		this.toNodeID = toNodeID;
	}
	
	public double calculateVCRatio(){
		return (double)this.flow/(double)this.capacity;
	}


	
}
